package com.example.rydwlib.adapter


import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.example.rydwlib.R
import com.example.rydwlib.bean.RyCountData
import com.example.rydwlib.bean.RyMainData


class RyMainAdapter(layoutResId: Int) : BaseQuickAdapter<RyMainData, BaseViewHolder>(layoutResId) {
    override fun convert(helper: BaseViewHolder, item: RyMainData) {
        val bean = item.countData
        helper.addOnClickListener(R.id.ry_item_over_person_ly)
            .addOnClickListener(R.id.ry_item_over_time_ly)
            .addOnClickListener(R.id.ry_item_ime_ly).addOnClickListener(R.id.ry_item_lead_ly)
            .addOnClickListener(R.id.ry_item_call_ly).addOnClickListener(R.id.ry_item_special_ly)
            .addOnClickListener(R.id.ry_item_special_err_ly).addOnClickListener(R.id.ry_item_sys_ly)
        helper.setText(R.id.ry_item_ime, bean.realtimenum.toString())
            .setText(R.id.ry_item_lead, bean.leadernum.toString() )
            .setText(R.id.ry_item_special,bean. specianum.toString())
            .setText(R.id.ry_item_special_err, bean.specialalarmnum.toString())
            .setText(R.id.ry_item_sys, bean.sysalarmnum.toString() )
            .setText(R.id.ry_item_call, bean.callnum.toString())
            .setText(R.id.ry_item_over_time, bean.overtimenum.toString() )
            .setText(R.id.ry_item_over_person, bean.overminenum.toString())

        val layoutManager = LinearLayoutManager(mContext)
        layoutManager.orientation = LinearLayoutManager.VERTICAL
        val recyclerView = helper.getView<RecyclerView>(R.id.ry_item_region_rcy)
        recyclerView.layoutManager = layoutManager
        val moreAdaptr = RyRegionAdapter(R.layout.ry_region_item, item.regionList)
        recyclerView.adapter = moreAdaptr

    }


}
